Skip to content

Add $unset and $geoNear stages #998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Sep 13, 2022
Merged

Conversation

katcharov
Copy link
Collaborator

Also use Java tests instead of groovy.

JAVA-4594

Copy link
Member

@rozza rozza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - found a few minor nits

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

public class AggregatesTest extends OperationFunctionalSpecification {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not mix groovy spock specs into junit tests, which by extending: OperationFunctionalSpecification we are. Good news is the setup and cleans are simple enough to be ported as they all originate from Java classes.

I would recommend adding a base java test class and / or registering an extension (similar to mongo-kafka/MongoDBHelper).

@katcharov katcharov requested a review from rozza September 1, 2022 17:00
*
* @since 4.8
*/
public final class GeoNearOption {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a new pattern for Aggregates builder methods. Looking at what we have currently, there is BucketOptions, BucketAutoOptions, GraphLookupOptions, UnwindOptions, MergeOptions, etc. all of which have a different design.

What's the rationale for diverging here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

* @mongodb.server.release 4.2
* @since 4.8
*/
public static Bson unset(final String... fields) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a public static Bson unset(final List<String> fields) version as well - this keeps it inline with other helpers.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@katcharov katcharov requested review from jyemin and rozza September 2, 2022 20:30
import org.bson.codecs.configuration.CodecRegistry;
import org.bson.conversions.Bson;

class SimplePipelineStage implements Bson {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be more inclined to revert this change and just add

<suppress checks="FileLength" files="Aggregates"/>

to config/checkstyle/suppressions.xml. Just because it's hard to justify why this one should move but not all the others.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@katcharov katcharov requested a review from jyemin September 6, 2022 18:41
@katcharov katcharov requested a review from jyemin September 12, 2022 16:12
Copy link
Collaborator

@jyemin jyemin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@rozza rozza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor nits - then LGTM


@Override
public String toString() {
return "Stage{name='$densify'"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: $geoNear

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good eye

@@ -75,12 +75,20 @@ import static com.mongodb.internal.operation.OperationUnitSpecification.getMaxWi

class OperationFunctionalSpecification extends Specification {

def setup() {
void setup() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this change can be reverted.

@katcharov katcharov merged commit bd9765a into mongodb:master Sep 13, 2022
@katcharov katcharov deleted the JAVA-4594 branch September 13, 2022 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants